"""
@Time ： 2022/7/7 21:24
@Auth ： ChenZhangKun
"""
import pymysql


def demo():
    # 获取链接
    conn = pymysql.connect(host="localhost", port=3306, user="root", password="1234", database='bos32')
    sql = '''
        select * from t_user
    
    '''
    # 拿到游标
    cursor = conn.cursor()
    # 拿到结果
    result = cursor.execute(sql)
    print("查询到受影响的行数%d" % result)
    # print(cursor.fetchall())
    print(cursor.fetchmany(2))
    for i in range(result):
        re = cursor.fetchone()
        print(type(re))
        print(re)

    cursor.close()
    conn.close()


if __name__ == '__main__':
    demo()
